package com.edgclub.edg.model;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.text.TextPaint;
import android.text.style.URLSpan;
import android.util.Log;
import android.view.View;

import com.edgclub.edg.activity.UserInfoOtherActivity;
import com.edgclub.edg.utils.util.DensityUtils;

public class Userspan extends URLSpan {

	private int mColor;
	private Activity activity;
	private User user;
	
	public Userspan(String url, int mColor, Context context, User user) {
		super(url);
		this.mColor = mColor;
		this.activity = (Activity) context;
		this.user = user;
	}

	public Userspan(String url) {
		super(url);
	}

	@Override
	public void onClick(View widget) {
		Log.d("user","-----点击了用户-------");
		Intent intent=new Intent(activity, UserInfoOtherActivity.class);
		intent.putExtra("user",user);
		activity.startActivity(intent);
	}

	@Override
	public void updateDrawState(TextPaint ds) {
		// TODO Auto-generated method stub
		super.updateDrawState(ds);
		ds.setColor(mColor);
		ds.setTextSize(DensityUtils.sp2px(activity,15));
		ds.setUnderlineText(false);
	}
}
